//
//  HTTPRequest.h
//  WeClubs
//
//  Created by KevinWang on 17/6/14.
//  Copyright © 2017年 Zed. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface ZRequestModel : NSObject
@property (nonatomic, strong) id task;
+ (ZRequestModel *)newWithTask:(id)task;
- (BOOL)isFinish;
- (void)cancel;

@end


//请求成功回调
typedef void(^requestSuccessCallBack)(id resposeObject);
//请求失败回调
typedef void(^requestErrorCallBack)(NSError *error);

@interface HTTPRequest : NSObject

//移除cookie
+ (void)removeCookie;
//保存cookie
+ (void)saveCookie;
//设置cookie
+ (void)setCookie;
//拼接地址
+(NSString *)InterfaceUrl:(NSString *)url;
//是否有网络
+ (BOOL)isNetworkAvailable;

// 获取七牛云配置信息, 仅加载一次
+ (void)getQiniuConfig;

/** @param urlString url地址
 *  @param parameter 参数
 *  @param success   成功回调
 *  @param failue    失败回调
 *
 */
/*POST请求*/
+ (ZRequestModel *)POST:(NSString *)urlString parameter:(NSDictionary *)parameter  success:(requestSuccessCallBack)success failure:(requestErrorCallBack)failue;

/*UPLOAD*/
+ (void)uploadImage:(UIImage *)image named:(NSString *)imageName success:(requestSuccessCallBack)success failure:(requestErrorCallBack)failue;;

@end
